package WaiBao;

import java.util.Arrays;

public class ZhangYiXin {
    public static void main(String[] args) {
        String [] Name = {"周琪(班长)", "徐艳艳(副班长)", "小李(学习委员)", "武汉书团支书)", "谭刚建", "叶少良", "吴夲", "邱友讯", "孙梦思", "沈广安", "胡义坤", "张蓝标",
                "冯晓茹", "复审西", "雪雪", "潘毛文", "周翊然", "吴桥", "胡烈", "夏茜茜", "邓牛", "成标", "王伟", "周楠", "路问", "张平", "学子航", "车第",
                "欧阳", "张亦心 (学生)"};//考生本人: 张亦心 (学生)
        int []  age = {20, 19, 17, 18,18, 19, 20, 20, 19, 19,19, 20, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 20};//考生年龄：20岁
        double[] S1 = {86, 81, 84, 91, 89, 69, 88, 89, 77, 91, 93, 77, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 96};
        double[] S2 = {78, 65, 81, 76, 81, 74, 82, 89, 94, 80, 91, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 97};
        double[] S3 = {85, 86, 98, 85, 75, 69, 78, 89, 80, 68, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};


        double a1;//代表每个学生的总分
        double b1;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            a1 = S1[i] +  S2[i] + S3[i];
//            b1 = ( a1 * 1.0) / 3;
//            System.out.println(Name[i] + "的总分为:" + a1);
//            System.out.println(Name[i] + "的平均分为:" +b1);
//        }

        double demo1 = 0;
        double[] jihe = new double[30];
//        for (int i = 0; i < 30; i++) {
//            demo1 = S1[i] + S2[i] + S3[i];
//            b1 = (demo1 * 1.0) / 3;
//            jihe[i] = b1;
//        }

//        for (int i = 0; i <jihe.length - 1; i++) {
//            for (int j = 0; j < jihe.length - i - 1; j++) {
//                if (jihe[j] < jihe[j + 1]) {
//                    double tep = jihe[j];
//                    jihe[j] = jihe[j + 1];
//                    jihe[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(jihe[i]);
//        }


        double APP1 = 0, APP2 = 0,  APP3 = 0;//计算每门课的平均分
        double good1 = 0, good2 = 0, good3 = 0;//计算每门课标准差
        double u1 = 0, u2 = 0,  u3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < S1.length; i++) {
            sum2+=S1[i];
        }
        APP1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ APP1);
        double Sum = 0;
        for (int i = 0; i < S2.length; i++) {
            Sum+=S2[i];
        }
        APP2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+ APP2);
        double sum = 0;
        for (int i = 0; i <S3.length; i++) {
            sum+=S3[i];
        }
        APP3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+ APP3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <S1.length; i++) {
            c1+= (S1[i] - APP1)*(S1[i] - APP1);
        }
        good1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+ good1);

        for (int i = 0; i < S2.length; i++) {
            c2+= (S2[i] - APP2)*(S2[i] - APP2);
        }
        good2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+ good2);

        for (int i = 0; i < S3.length; i++) {
            c3+= (S3[i] - APP3)*(S3[i] -  APP3);
        }
        good3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+ good3);
////
////
//        Arrays.sort(S1);
//        Arrays.sort(S2);
//        Arrays.sort(S3);
//        u1 =( S1[14]+S1[15])*1.0/2;
//        u2 =( S2[14]+S2[15])*1.0/2;
//        u3 =( S3[14]+S3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+ u1);
//        System.out.println("微生物学的中位数为:"+ u2);
//        System.out.println("人体组织解剖学的中位数为:"+ u3);
    }
}
